package ups.glre.news.webservice.client.impl;

import java.util.List;

import javax.xml.ws.WebServiceRef;

import ups.glre.news.webservice.client.NewsWebServiceClient;
import ups.glre.news.webservice.client.wsdl.NewsDTO;
import ups.glre.news.webservice.client.wsdl.NewsWebService;

public class NewsWebServiceClientImpl implements  NewsWebServiceClient {

	@WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/hello?wsdl")
	static NewsWebService service;
	
	@Override
	public void displayNews() {
		List<NewsDTO> allNews = service.getAllNews();
		for(NewsDTO newsDTO : allNews) {
			System.out.println("news category=" + newsDTO.getCategory());
		}
	}
	@Override
	public void createNews() {
		for(int i=0; i < 5; i++) {
			service.publishNews("category" + i, "author" + i, "", "", "");
		}
	}

}
